---
apiVersion: v1
kind: Secret
metadata:
  name: alertmanagers-tls-config
  namespace: d8-monitoring
  {{- include "helm_lib_module_labels" (list . (dict "app" "alertmanager")) | nindent 2 }}
data:
{{- if (hasKey .Values.prometheus.internal.alertmanagers "byAddress") }}
{{- range .Values.prometheus.internal.alertmanagers.byAddress }}
{{- if .tlsConfig }}
  {{- if .tlsConfig.ca }}
  {{ .name }}_ca: {{ .tlsConfig.ca | b64enc }}
  {{- end }}
  {{- if .tlsConfig.key }}
  {{ .name }}_key: {{ .tlsConfig.key | b64enc }}
  {{- end }}
  {{- if .tlsConfig.cert }}
  {{ .name }}_cert: {{ .tlsConfig.cert | b64enc }}
  {{- end }}
{{- end }}
{{- end }}
{{- end }}
